\(\int \cot (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx\) [260]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 172 \[ \int \cot (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\left (4 a^3 A b-4 a A b^3+a^4 B-6 a^2 b^2 B+b^4 B\right ) x-\frac {b \left (6 a^2 A b-A b^3+4 a^3 B-4 a b^2 B\right ) \log (\cos (c+d x))}{d}+\frac {a^4 A \log (\sin (c+d x))}{d}+\frac {b^2 \left (3 a A b+3 a^2 B-b^2 B\right ) \tan (c+d x)}{d}+\frac {b (A b+2 a B) (a+b \tan (c+d x))^2}{2 d}+\frac {b B (a+b \tan (c+d x))^3}{3 d} \]

[Out]

(4*A*a^3*b-4*A*a*b^3+B*a^4-6*B*a^2*b^2+B*b^4)*x-b*(6*A*a^2*b-A*b^3+4*B*a^3-4*B*a*b^2)*ln(cos(d*x+c))/d+a^4*A*l
n(sin(d*x+c))/d+b^2*(3*A*a*b+3*B*a^2-B*b^2)*tan(d*x+c)/d+1/2*b*(A*b+2*B*a)*(a+b*tan(d*x+c))^2/d+1/3*b*B*(a+b*t
an(d*x+c))^3/d

Rubi [A] (verified)

Time = 0.52 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.172, Rules used = {3688, 3728, 3718, 3705, 3556} \[ \int \cot (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {a^4 A \log (\sin (c+d x))}{d}+\frac {b^2 \left (3 a^2 B+3 a A b-b^2 B\right ) \tan (c+d x)}{d}-\frac {b \left (4 a^3 B+6 a^2 A b-4 a b^2 B-A b^3\right ) \log (\cos (c+d x))}{d}+x \left (a^4 B+4 a^3 A b-6 a^2 b^2 B-4 a A b^3+b^4 B\right )+\frac {b (2 a B+A b) (a+b \tan (c+d x))^2}{2 d}+\frac {b B (a+b \tan (c+d x))^3}{3 d} \]

[In]

Int[Cot[c + d*x]*(a + b*Tan[c + d*x])^4*(A + B*Tan[c + d*x]),x]

[Out]

(4*a^3*A*b - 4*a*A*b^3 + a^4*B - 6*a^2*b^2*B + b^4*B)*x - (b*(6*a^2*A*b - A*b^3 + 4*a^3*B - 4*a*b^2*B)*Log[Cos
[c + d*x]])/d + (a^4*A*Log[Sin[c + d*x]])/d + (b^2*(3*a*A*b + 3*a^2*B - b^2*B)*Tan[c + d*x])/d + (b*(A*b + 2*a
*B)*(a + b*Tan[c + d*x])^2)/(2*d) + (b*B*(a + b*Tan[c + d*x])^3)/(3*d)

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3688

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e
_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*B*(a + b*Tan[e + f*x])^(m - 1)*((c + d*Tan[e + f*x])^(n + 1)/(d*f
*(m + n))), x] + Dist[1/(d*(m + n)), Int[(a + b*Tan[e + f*x])^(m - 2)*(c + d*Tan[e + f*x])^n*Simp[a^2*A*d*(m +
 n) - b*B*(b*c*(m - 1) + a*d*(n + 1)) + d*(m + n)*(2*a*A*b + B*(a^2 - b^2))*Tan[e + f*x] - (b*B*(b*c - a*d)*(m
 - 1) - b*(A*b + a*B)*d*(m + n))*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*
c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && GtQ[m, 1] && (IntegerQ[m] || IntegersQ[2*m, 2*n]) &&
 !(IGtQ[n, 1] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])))

Rule 3705

Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2)/tan[(e_.) + (f_.)*(x_)], x_Symbol
] :> Simp[B*x, x] + (Dist[A, Int[1/Tan[e + f*x], x], x] + Dist[C, Int[Tan[e + f*x], x], x]) /; FreeQ[{e, f, A,
 B, C}, x] && NeQ[A, C]

Rule 3718

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)*tan[(e
_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[b*C*Tan[e + f*x]*((c + d*Tan[e + f*x])
^(n + 1)/(d*f*(n + 2))), x] - Dist[1/(d*(n + 2)), Int[(c + d*Tan[e + f*x])^n*Simp[b*c*C - a*A*d*(n + 2) - (A*b
 + a*B - b*C)*d*(n + 2)*Tan[e + f*x] - (a*C*d*(n + 2) - b*(c*C - B*d*(n + 2)))*Tan[e + f*x]^2, x], x], x] /; F
reeQ[{a, b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[c^2 + d^2, 0] &&  !LtQ[n, -1]

Rule 3728

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*
tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[C*(a + b*Tan[e + f*x])^m*((c + d
*Tan[e + f*x])^(n + 1)/(d*f*(m + n + 1))), x] + Dist[1/(d*(m + n + 1)), Int[(a + b*Tan[e + f*x])^(m - 1)*(c +
d*Tan[e + f*x])^n*Simp[a*A*d*(m + n + 1) - C*(b*c*m + a*d*(n + 1)) + d*(A*b + a*B - b*C)*(m + n + 1)*Tan[e + f
*x] - (C*m*(b*c - a*d) - b*B*d*(m + n + 1))*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, n}
, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && GtQ[m, 0] &&  !(IGtQ[n, 0] && ( !Intege
rQ[m] || (EqQ[c, 0] && NeQ[a, 0])))

Rubi steps \begin{align*} \text {integral}& = \frac {b B (a+b \tan (c+d x))^3}{3 d}+\frac {1}{3} \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (3 a^2 A+3 \left (2 a A b+a^2 B-b^2 B\right ) \tan (c+d x)+3 b (A b+2 a B) \tan ^2(c+d x)\right ) \, dx \\ & = \frac {b (A b+2 a B) (a+b \tan (c+d x))^2}{2 d}+\frac {b B (a+b \tan (c+d x))^3}{3 d}+\frac {1}{6} \int \cot (c+d x) (a+b \tan (c+d x)) \left (6 a^3 A+6 \left (3 a^2 A b-A b^3+a^3 B-3 a b^2 B\right ) \tan (c+d x)+6 b \left (3 a A b+3 a^2 B-b^2 B\right ) \tan ^2(c+d x)\right ) \, dx \\ & = \frac {b^2 \left (3 a A b+3 a^2 B-b^2 B\right ) \tan (c+d x)}{d}+\frac {b (A b+2 a B) (a+b \tan (c+d x))^2}{2 d}+\frac {b B (a+b \tan (c+d x))^3}{3 d}-\frac {1}{6} \int \cot (c+d x) \left (-6 a^4 A-6 \left (4 a^3 A b-4 a A b^3+a^4 B-6 a^2 b^2 B+b^4 B\right ) \tan (c+d x)-6 b \left (6 a^2 A b-A b^3+4 a^3 B-4 a b^2 B\right ) \tan ^2(c+d x)\right ) \, dx \\ & = \left (4 a^3 A b-4 a A b^3+a^4 B-6 a^2 b^2 B+b^4 B\right ) x+\frac {b^2 \left (3 a A b+3 a^2 B-b^2 B\right ) \tan (c+d x)}{d}+\frac {b (A b+2 a B) (a+b \tan (c+d x))^2}{2 d}+\frac {b B (a+b \tan (c+d x))^3}{3 d}+\left (a^4 A\right ) \int \cot (c+d x) \, dx+\left (b \left (6 a^2 A b-A b^3+4 a^3 B-4 a b^2 B\right )\right ) \int \tan (c+d x) \, dx \\ & = \left (4 a^3 A b-4 a A b^3+a^4 B-6 a^2 b^2 B+b^4 B\right ) x-\frac {b \left (6 a^2 A b-A b^3+4 a^3 B-4 a b^2 B\right ) \log (\cos (c+d x))}{d}+\frac {a^4 A \log (\sin (c+d x))}{d}+\frac {b^2 \left (3 a A b+3 a^2 B-b^2 B\right ) \tan (c+d x)}{d}+\frac {b (A b+2 a B) (a+b \tan (c+d x))^2}{2 d}+\frac {b B (a+b \tan (c+d x))^3}{3 d} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 1.52 (sec) , antiderivative size = 149, normalized size of antiderivative = 0.87 \[ \int \cot (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {-3 (a+i b)^4 (A+i B) \log (i-\tan (c+d x))+6 a^4 A \log (\tan (c+d x))-3 (a-i b)^4 (A-i B) \log (i+\tan (c+d x))+6 b^2 \left (3 a A b+3 a^2 B-b^2 B\right ) \tan (c+d x)+3 b (A b+2 a B) (a+b \tan (c+d x))^2+2 b B (a+b \tan (c+d x))^3}{6 d} \]

[In]

Integrate[Cot[c + d*x]*(a + b*Tan[c + d*x])^4*(A + B*Tan[c + d*x]),x]

[Out]

(-3*(a + I*b)^4*(A + I*B)*Log[I - Tan[c + d*x]] + 6*a^4*A*Log[Tan[c + d*x]] - 3*(a - I*b)^4*(A - I*B)*Log[I +
Tan[c + d*x]] + 6*b^2*(3*a*A*b + 3*a^2*B - b^2*B)*Tan[c + d*x] + 3*b*(A*b + 2*a*B)*(a + b*Tan[c + d*x])^2 + 2*
b*B*(a + b*Tan[c + d*x])^3)/(6*d)

Maple [A] (verified)

Time = 0.23 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.00

method result size
parallelrisch \(\frac {\left (-3 A \,a^{4}+18 A \,a^{2} b^{2}-3 A \,b^{4}+12 B \,a^{3} b -12 B a \,b^{3}\right ) \ln \left (\sec ^{2}\left (d x +c \right )\right )+6 A \,a^{4} \ln \left (\tan \left (d x +c \right )\right )+2 B \,b^{4} \left (\tan ^{3}\left (d x +c \right )\right )+\left (3 A \,b^{4}+12 B a \,b^{3}\right ) \left (\tan ^{2}\left (d x +c \right )\right )+\left (24 A a \,b^{3}+36 B \,a^{2} b^{2}-6 B \,b^{4}\right ) \tan \left (d x +c \right )+24 d \left (A \,a^{3} b -A a \,b^{3}+\frac {1}{4} B \,a^{4}-\frac {3}{2} B \,a^{2} b^{2}+\frac {1}{4} B \,b^{4}\right ) x}{6 d}\) \(172\)
norman \(\left (4 A \,a^{3} b -4 A a \,b^{3}+B \,a^{4}-6 B \,a^{2} b^{2}+B \,b^{4}\right ) x +\frac {b^{2} \left (4 A a b +6 B \,a^{2}-B \,b^{2}\right ) \tan \left (d x +c \right )}{d}+\frac {B \,b^{4} \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {b^{3} \left (A b +4 B a \right ) \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {A \,a^{4} \ln \left (\tan \left (d x +c \right )\right )}{d}-\frac {\left (A \,a^{4}-6 A \,a^{2} b^{2}+A \,b^{4}-4 B \,a^{3} b +4 B a \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) \(175\)
derivativedivides \(\frac {\frac {B \,b^{4} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+\frac {A \,b^{4} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+2 B a \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )+4 A a \,b^{3} \tan \left (d x +c \right )+6 B \,a^{2} b^{2} \tan \left (d x +c \right )-B \,b^{4} \tan \left (d x +c \right )+\frac {\left (-A \,a^{4}+6 A \,a^{2} b^{2}-A \,b^{4}+4 B \,a^{3} b -4 B a \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (4 A \,a^{3} b -4 A a \,b^{3}+B \,a^{4}-6 B \,a^{2} b^{2}+B \,b^{4}\right ) \arctan \left (\tan \left (d x +c \right )\right )+A \,a^{4} \ln \left (\tan \left (d x +c \right )\right )}{d}\) \(192\)
default \(\frac {\frac {B \,b^{4} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+\frac {A \,b^{4} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+2 B a \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )+4 A a \,b^{3} \tan \left (d x +c \right )+6 B \,a^{2} b^{2} \tan \left (d x +c \right )-B \,b^{4} \tan \left (d x +c \right )+\frac {\left (-A \,a^{4}+6 A \,a^{2} b^{2}-A \,b^{4}+4 B \,a^{3} b -4 B a \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (4 A \,a^{3} b -4 A a \,b^{3}+B \,a^{4}-6 B \,a^{2} b^{2}+B \,b^{4}\right ) \arctan \left (\tan \left (d x +c \right )\right )+A \,a^{4} \ln \left (\tan \left (d x +c \right )\right )}{d}\) \(192\)
risch \(\frac {8 i B \,a^{3} b c}{d}-\frac {2 i A \,b^{4} c}{d}-i A \,a^{4} x +\frac {A \,a^{4} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A \,b^{4}}{d}+4 A \,a^{3} b x -4 A a \,b^{3} x -6 B \,a^{2} b^{2} x +B \,a^{4} x +B \,b^{4} x -4 i B a \,b^{3} x -\frac {2 i a^{4} A c}{d}+\frac {12 i A \,a^{2} b^{2} c}{d}+\frac {2 i b^{2} \left (-3 i A \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-12 i B a b \,{\mathrm e}^{4 i \left (d x +c \right )}+12 A a b \,{\mathrm e}^{4 i \left (d x +c \right )}+18 B \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 B \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-3 i A \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-12 i B a b \,{\mathrm e}^{2 i \left (d x +c \right )}+24 A a b \,{\mathrm e}^{2 i \left (d x +c \right )}+36 B \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 B \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+12 A a b +18 B \,a^{2}-4 B \,b^{2}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-i A \,b^{4} x +6 i A \,a^{2} b^{2} x -\frac {8 i B a \,b^{3} c}{d}+4 i B \,a^{3} b x -\frac {6 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A \,a^{2} b^{2}}{d}-\frac {4 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B \,a^{3} b}{d}+\frac {4 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B a \,b^{3}}{d}\) \(443\)

[In]

int(cot(d*x+c)*(a+b*tan(d*x+c))^4*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/6*((-3*A*a^4+18*A*a^2*b^2-3*A*b^4+12*B*a^3*b-12*B*a*b^3)*ln(sec(d*x+c)^2)+6*A*a^4*ln(tan(d*x+c))+2*B*b^4*tan
(d*x+c)^3+(3*A*b^4+12*B*a*b^3)*tan(d*x+c)^2+(24*A*a*b^3+36*B*a^2*b^2-6*B*b^4)*tan(d*x+c)+24*d*(A*a^3*b-A*a*b^3
+1/4*B*a^4-3/2*B*a^2*b^2+1/4*B*b^4)*x)/d

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 185, normalized size of antiderivative = 1.08 \[ \int \cot (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {2 \, B b^{4} \tan \left (d x + c\right )^{3} + 3 \, A a^{4} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} d x + 3 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \tan \left (d x + c\right )^{2} - 3 \, {\left (4 \, B a^{3} b + 6 \, A a^{2} b^{2} - 4 \, B a b^{3} - A b^{4}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (6 \, B a^{2} b^{2} + 4 \, A a b^{3} - B b^{4}\right )} \tan \left (d x + c\right )}{6 \, d} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^4*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/6*(2*B*b^4*tan(d*x + c)^3 + 3*A*a^4*log(tan(d*x + c)^2/(tan(d*x + c)^2 + 1)) + 6*(B*a^4 + 4*A*a^3*b - 6*B*a^
2*b^2 - 4*A*a*b^3 + B*b^4)*d*x + 3*(4*B*a*b^3 + A*b^4)*tan(d*x + c)^2 - 3*(4*B*a^3*b + 6*A*a^2*b^2 - 4*B*a*b^3
 - A*b^4)*log(1/(tan(d*x + c)^2 + 1)) + 6*(6*B*a^2*b^2 + 4*A*a*b^3 - B*b^4)*tan(d*x + c))/d

Sympy [A] (verification not implemented)

Time = 0.75 (sec) , antiderivative size = 291, normalized size of antiderivative = 1.69 \[ \int \cot (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\begin {cases} - \frac {A a^{4} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {A a^{4} \log {\left (\tan {\left (c + d x \right )} \right )}}{d} + 4 A a^{3} b x + \frac {3 A a^{2} b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - 4 A a b^{3} x + \frac {4 A a b^{3} \tan {\left (c + d x \right )}}{d} - \frac {A b^{4} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {A b^{4} \tan ^{2}{\left (c + d x \right )}}{2 d} + B a^{4} x + \frac {2 B a^{3} b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - 6 B a^{2} b^{2} x + \frac {6 B a^{2} b^{2} \tan {\left (c + d x \right )}}{d} - \frac {2 B a b^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {2 B a b^{3} \tan ^{2}{\left (c + d x \right )}}{d} + B b^{4} x + \frac {B b^{4} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {B b^{4} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\left (c \right )}\right ) \left (a + b \tan {\left (c \right )}\right )^{4} \cot {\left (c \right )} & \text {otherwise} \end {cases} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))**4*(A+B*tan(d*x+c)),x)

[Out]

Piecewise((-A*a**4*log(tan(c + d*x)**2 + 1)/(2*d) + A*a**4*log(tan(c + d*x))/d + 4*A*a**3*b*x + 3*A*a**2*b**2*
log(tan(c + d*x)**2 + 1)/d - 4*A*a*b**3*x + 4*A*a*b**3*tan(c + d*x)/d - A*b**4*log(tan(c + d*x)**2 + 1)/(2*d)
+ A*b**4*tan(c + d*x)**2/(2*d) + B*a**4*x + 2*B*a**3*b*log(tan(c + d*x)**2 + 1)/d - 6*B*a**2*b**2*x + 6*B*a**2
*b**2*tan(c + d*x)/d - 2*B*a*b**3*log(tan(c + d*x)**2 + 1)/d + 2*B*a*b**3*tan(c + d*x)**2/d + B*b**4*x + B*b**
4*tan(c + d*x)**3/(3*d) - B*b**4*tan(c + d*x)/d, Ne(d, 0)), (x*(A + B*tan(c))*(a + b*tan(c))**4*cot(c), True))

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 175, normalized size of antiderivative = 1.02 \[ \int \cot (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {2 \, B b^{4} \tan \left (d x + c\right )^{3} + 6 \, A a^{4} \log \left (\tan \left (d x + c\right )\right ) + 3 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \tan \left (d x + c\right )^{2} + 6 \, {\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} {\left (d x + c\right )} - 3 \, {\left (A a^{4} - 4 \, B a^{3} b - 6 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (6 \, B a^{2} b^{2} + 4 \, A a b^{3} - B b^{4}\right )} \tan \left (d x + c\right )}{6 \, d} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^4*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/6*(2*B*b^4*tan(d*x + c)^3 + 6*A*a^4*log(tan(d*x + c)) + 3*(4*B*a*b^3 + A*b^4)*tan(d*x + c)^2 + 6*(B*a^4 + 4*
A*a^3*b - 6*B*a^2*b^2 - 4*A*a*b^3 + B*b^4)*(d*x + c) - 3*(A*a^4 - 4*B*a^3*b - 6*A*a^2*b^2 + 4*B*a*b^3 + A*b^4)
*log(tan(d*x + c)^2 + 1) + 6*(6*B*a^2*b^2 + 4*A*a*b^3 - B*b^4)*tan(d*x + c))/d

Giac [A] (verification not implemented)

none

Time = 1.74 (sec) , antiderivative size = 191, normalized size of antiderivative = 1.11 \[ \int \cot (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {2 \, B b^{4} \tan \left (d x + c\right )^{3} + 12 \, B a b^{3} \tan \left (d x + c\right )^{2} + 3 \, A b^{4} \tan \left (d x + c\right )^{2} + 6 \, A a^{4} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right ) + 36 \, B a^{2} b^{2} \tan \left (d x + c\right ) + 24 \, A a b^{3} \tan \left (d x + c\right ) - 6 \, B b^{4} \tan \left (d x + c\right ) + 6 \, {\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} {\left (d x + c\right )} - 3 \, {\left (A a^{4} - 4 \, B a^{3} b - 6 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{6 \, d} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^4*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

1/6*(2*B*b^4*tan(d*x + c)^3 + 12*B*a*b^3*tan(d*x + c)^2 + 3*A*b^4*tan(d*x + c)^2 + 6*A*a^4*log(abs(tan(d*x + c
))) + 36*B*a^2*b^2*tan(d*x + c) + 24*A*a*b^3*tan(d*x + c) - 6*B*b^4*tan(d*x + c) + 6*(B*a^4 + 4*A*a^3*b - 6*B*
a^2*b^2 - 4*A*a*b^3 + B*b^4)*(d*x + c) - 3*(A*a^4 - 4*B*a^3*b - 6*A*a^2*b^2 + 4*B*a*b^3 + A*b^4)*log(tan(d*x +
 c)^2 + 1))/d

Mupad [B] (verification not implemented)

Time = 7.47 (sec) , antiderivative size = 151, normalized size of antiderivative = 0.88 \[ \int \cot (c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx=\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {A\,b^4}{2}+2\,B\,a\,b^3\right )}{d}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,b^4-2\,a\,b^2\,\left (2\,A\,b+3\,B\,a\right )\right )}{d}+\frac {A\,a^4\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )\,{\left (b+a\,1{}\mathrm {i}\right )}^4}{2\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (A+B\,1{}\mathrm {i}\right )\,{\left (-b+a\,1{}\mathrm {i}\right )}^4}{2\,d}+\frac {B\,b^4\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d} \]

[In]

int(cot(c + d*x)*(A + B*tan(c + d*x))*(a + b*tan(c + d*x))^4,x)

[Out]

(tan(c + d*x)^2*((A*b^4)/2 + 2*B*a*b^3))/d - (tan(c + d*x)*(B*b^4 - 2*a*b^2*(2*A*b + 3*B*a)))/d + (A*a^4*log(t
an(c + d*x)))/d - (log(tan(c + d*x) + 1i)*(A - B*1i)*(a*1i + b)^4)/(2*d) - (log(tan(c + d*x) - 1i)*(A + B*1i)*
(a*1i - b)^4)/(2*d) + (B*b^4*tan(c + d*x)^3)/(3*d)